package com.platform.qujia.service;


import com.baomidou.mybatisplus.extension.service.IService;
import com.platform.qujia.dao.ElectronicCardRefundRecordMapper;
import com.platform.qujia.pojo.*;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface ElectronicMembershipCardService {


    //获取用户储蓄卡列表
    List<CustomerElectronicCard> getElectronicCardListBycardOilsTypeArray(CustomerElectronicCard customerElectronicCard);
    //获取用户储蓄卡列表
    List<CustomerElectronicCard> getElectronicCardList(CustomerElectronicCard customerElectronicCard);

    //获取用要充值电子会员卡的信息
    CustomerElectronicCard getElectronicCardInfo(CustomerElectronicCard customerElectronicCard);

    //更新电子会员卡信息
    void updateElectronicCardInfo(CustomerElectronicCard customerElectronicCard);

    //新增电子会员卡充值使用记录
    void insetCardUseRecordRecharge(CustomerCardUseRecord customerCardUseRecord);

    //新增电子会员卡消费使用记录
    void insetCardUseRecordConsumption(CustomerCardUseRecord customerCardUseRecord);

    //获取用户储蓄卡的使用记录
    List<CustomerCardUseRecord> getCardUseRecordList(CustomerCardUseRecord customerCardUseRecord);

    //根据订单号查询电子会员卡的充值记录信息
    CustomerCardUseRecord getCardRecordByOrderNo(CustomerCardUseRecord customerCardUseRecord);

    //根据商户订单号查询电子会员卡的充值记录信息
    CustomerCardUseRecord getCardRecordByMerchantsNumber(CustomerCardUseRecord customerCardUseRecord);

    //根据unionId和油站更新客户余额
    void updateElectronicCardInfoByPhone(CustomerElectronicCard customerElectronicCard);

    //根据订单号更新用户充值记录的状态
    void updateCardRecordStatusByOrderNo(CustomerCardUseRecord customerCardUseRecord);

    //查询油站电子会员卡（储蓄卡）充值设置规则
    List<CustomerCardSetting> getCardRechargeSettingList(CustomerCardSetting customerCardSetting);

    //查询油站的会员卡启用标识 （1、启动 2，停用)
    String getStationCardEnabledFlag(Integer stationId);

    //根据unionId和油站ID获取用户用要充值电子会员卡(储蓄卡)信息
    CustomerElectronicCard getElectronicCardInfoByPhone(CustomerElectronicCard customerElectronicCard);

    //插入电子会员卡
    void insetElectronicCard(CustomerElectronicCard customerElectronicCard);

    //根据小程序用户openId查询客户电子会员卡信息-
    CustomerElectronicCard getElectronicCardInfoByMinaOpenId(CustomerElectronicCard customerElectronicCard);


    //修改电子会员卡充值使用记录
    void updateCardUseRecordRecharge(CustomerCardUseRecord customerCardUseRecord);

    //查询电子卡的最低充值金额
    List<CustomerCardSetting> getCardRechargeMinAmt(CustomerCardSetting customerCardSetting);

    /**
     * 查询用户电子卡，没有则创建
     * @param appUserInfos
     * @param cardType
     * @param station
     * @return
     */
    CustomerElectronicCard getAndCreateCustomerElectronicCard(AppUserInfo appUserInfos, String cardType, Station station);

    CustomerElectronicCard getCustomerElectronicCard(AppUserInfo appUserInfos, String cardType, Station station);

    List<CustomerElectronicCard> getCustomerElectronicCardListForEnterprise(String mobilePhone, String[] cardTypes, Integer enterpriseId);
    List<CustomerElectronicCard> getCustomerElectronicCardListForStation(String mobilePhone, String[] cardTypes, Integer stationId);

    List<CustomerElectronicCard> queryCustomerElectronicCardList(String mobilePhone, String[] cardTypes, Station station);
    void updateElectronicCardInfoByPhone(CustomerElectronicCard.CustomerElectronicCardBuilder builder,Station station);

    //BigDecimal getCustomerElectronicCardBalance(String mobilePhone, String memberCode, Enterprise enterprise);
    BigDecimal getCustomerElectronicCardBalance(String mobilePhone, Integer enterpriseId, boolean cardUseForAll, List<String> types);

    List<CustomerCardSettingDetail> selectCardSettingDetail(CustomerCardSettingDetail customerCardSettingDetail);

    List<CustomerCardSettingDetailContent> getCardSettingDetailContents(CustomerCardSettingDetailContent contentQuery);

    BigDecimal getFreezePresentAmt(CustomerCardUseRecord useRecordQuery);

    boolean isNonpayment(String mobilePhone,Station station,BigDecimal amt,BigDecimal balance);

    CustomerCardUseRecord selectCustomerCardUseRecordByOrderNo(String orderNo);

    List<CustomerCardSettingDetailContent> queryCardSettingDetailContentsByCcsdIdsBetweenAmt(@Param("ccsdIds") List<Integer> ccsdIds, @Param("amt") BigDecimal amt);

    Integral rechargeActivityGiveIntegral(String orderNo);

    Integral rechargeActivityGiveIntegral(CustomerCardUseRecord customerCardUseRecord);

    int incrCustomerElectronicCardBalance(BigDecimal incrAmt, BigDecimal incrPresentAmt, CustomerElectronicCard card);

    void sxfDzkRechargeCallback(String payTime, String ordNo, String amt, String transactionId, String payType,String savedPayType,Integer preId);

    //更新用户的电子会员卡的金额和赠送金额
    int updateUserPresentAmt(Map<String, Object> map);

    //查询客户电子卡交易记录列表
    List<CustomerCardUseRecord> selectCustomerCardUseRecords(CustomerCardUseRecord customerCardUseRecord);

    CustomerCardUseRecord selectCustomerCardUseRecordByPhoneAndStationId(String phone,Long stationId);

    int updateReturnCashById(CustomerElectronicCard customerElectronicCard);
}
